<%@page contentType="application/json" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="app.area.SuperArea"%>
<%@page import="app.labs.CheckPoint"%>
<%
    float x = Float.parseFloat(request.getParameter("x"));
    float y = Float.parseFloat(request.getParameter("y"));
    float r = Float.parseFloat(request.getParameter("r"));
    SuperArea superArea = new SuperArea();
    boolean contains = superArea.contains(x, y, r);
    
    List<CheckPoint> checkPointHistory = (List<CheckPoint>)session.getAttribute("checkPointHistory");
    if (checkPointHistory == null) {
        checkPointHistory = new ArrayList<CheckPoint>();
    }
    checkPointHistory.add(new CheckPoint(x, y, r, contains));
    session.setAttribute("checkPointHistory", checkPointHistory);
    
    StringBuilder str = new StringBuilder("");
    for (CheckPoint cp : checkPointHistory) {
        str.append("Точка ("+cp.getX()+", "+cp.getY()+") при R="+cp.getR()+" "+(cp.isContains() ? "попадание" : "промах")+"<br/>");
    }
%>
{
    "str": "<%=str.toString()%>"
}